package com.swanclouds.redfish.managers.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.DeviceEntity;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class SmtpServiceModel implements DeviceEntity {
    //SMTP服务资源的访问路径
    @JsonProperty("@odata.id")
    private String dataId;

    //SMTP服务资源模型的OData描述信息
    @JsonProperty("@odata.context")
    private String context;

    //SMTP服务资源的类型
    @JsonProperty("@odata.type")
    private String type;

    //SMTP服务资源的ID
    @JsonProperty("Id")
    private String id;

    //SMTP服务资源的名称
    @JsonProperty("Name")
    private String name;

    //SMTP服务的使能状态
    @JsonProperty("ServiceEnabled")
    private String serviceEnabled;

     //SMTP服务器地址
    @JsonProperty("ServerAddress")
    private String serverAddress;

    //是否启用TLS
    @JsonProperty("TLSEnabled")
    private String tlsEnabled;

    //是否使用匿名登录
    @JsonProperty("AnonymousLoginEnabled")
    private String anonymousLoginEnabled;

    //发件人用户名
    @JsonProperty("SenderUserName")
    private String senderUserName;

     //发件人邮箱密码
    @JsonProperty("SenderPassword")
    private String senderPassword;

     //收件人邮箱地址
    @JsonProperty("SenderAddress")
    private String senderAddress;

    //邮件主题
    @JsonProperty("EmailSubject")
    private String emailSubject;

    /**
     * 主题附加信息
     * ● HostName
     * ● BoardSN
     * ● ProductAssetTag
     */
    @JsonProperty("EmailSubjectContains")
    private String[] emailSubjectContains;

    /**
     * 告警发送级别
     * ● Critical （紧急）
     * ● Major （严重及以上）
     * ● Minor （轻微及以上）
     * ● Normal （正常及以上）
     * ● null（不发送告警）
     */
    @JsonProperty("AlarmSeverity")
    private String alarmSeverity;

    //接收告警的邮件地址
    @JsonProperty("RecipientAddresses")
    private List<Map<String,Object>> recipientAddresses;

    //SMTP服务资源可执行操作
    @JsonProperty("Actions")
    private Map<String,Object> actions;

    public void setDataId(String dataId) {
        this.dataId = dataId;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getServiceEnabled() {
        return serviceEnabled;
    }

    public void setServiceEnabled(String serviceEnabled) {
        this.serviceEnabled = serviceEnabled;
    }

    public String getServerAddress() {
        return serverAddress;
    }

    public void setServerAddress(String serverAddress) {
        this.serverAddress = serverAddress;
    }

    public String getTlsEnabled() {
        return tlsEnabled;
    }

    public void setTlsEnabled(String tlsEnabled) {
        this.tlsEnabled = tlsEnabled;
    }

    public String getAnonymousLoginEnabled() {
        return anonymousLoginEnabled;
    }

    public void setAnonymousLoginEnabled(String anonymousLoginEnabled) {
        this.anonymousLoginEnabled = anonymousLoginEnabled;
    }

    public String getSenderUserName() {
        return senderUserName;
    }

    public void setSenderUserName(String senderUserName) {
        this.senderUserName = senderUserName;
    }

    public String getSenderPassword() {
        return senderPassword;
    }

    public void setSenderPassword(String senderPassword) {
        this.senderPassword = senderPassword;
    }

    public String getSenderAddress() {
        return senderAddress;
    }

    public void setSenderAddress(String senderAddress) {
        this.senderAddress = senderAddress;
    }

    public String getEmailSubject() {
        return emailSubject;
    }

    public void setEmailSubject(String emailSubject) {
        this.emailSubject = emailSubject;
    }

    public String[] getEmailSubjectContains() {
        return emailSubjectContains;
    }

    public void setEmailSubjectContains(String[] emailSubjectContains) {
        this.emailSubjectContains = emailSubjectContains;
    }

    public String getAlarmSeverity() {
        return alarmSeverity;
    }

    public void setAlarmSeverity(String alarmSeverity) {
        this.alarmSeverity = alarmSeverity;
    }

    public List<Map<String, Object>> getRecipientAddresses() {
        return recipientAddresses;
    }

    public void setRecipientAddresses(List<Map<String, Object>> recipientAddresses) {
        this.recipientAddresses = recipientAddresses;
    }

    public Map<String, Object> getActions() {
        return actions;
    }

    public void setActions(Map<String, Object> actions) {
        this.actions = actions;
    }

    @Override
    public String getDataId() {
        return dataId;
    }

    @Override
    public String getContext() {
        return context;
    }

    @Override
    public String getType() {
        return type;
    }

    @Override
    public String getId() {
        return id;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        }catch (JsonProcessingException e){
        }
        return "SmtpServiceModel{" +
                "dataId='" + dataId + '\'' +
                ", context='" + context + '\'' +
                ", type='" + type + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", serviceEnabled='" + serviceEnabled + '\'' +
                ", serverAddress='" + serverAddress + '\'' +
                ", tlsEnabled='" + tlsEnabled + '\'' +
                ", anonymousLoginEnabled='" + anonymousLoginEnabled + '\'' +
                ", senderUserName='" + senderUserName + '\'' +
                ", senderPassword='" + senderPassword + '\'' +
                ", senderAddress='" + senderAddress + '\'' +
                ", emailSubject='" + emailSubject + '\'' +
                ", emailSubjectContains=" + Arrays.toString(emailSubjectContains) +
                ", alarmSeverity='" + alarmSeverity + '\'' +
                ", RecipientAddresses=" + recipientAddresses +
                ", actions=" + actions +
                '}';
    }
}
